<template>
  <el-container direction="vertical" style="min-height: 100vh;">
    <el-header height="auto">
      <NavBar />
    </el-header>

    <el-main class="scroll-container">
      <router-view />
    <AppFooter />

    </el-main>
    <!--回到顶部-->
   <el-backtop
  target=".scroll-container"
  :visibility-height="0"
  :right="100"
  :bottom="420"
  @show="showBackTop = true"
  @hide="showBackTop = true"
>
  <transition name="fade-scale">
    <div v-if="showBackTop" class="backtop-inner">
      <el-icon><ArrowUp /></el-icon>
    </div>
  </transition>
</el-backtop>


  </el-container>
</template>


<script setup>
import NavBar from '@/components/NavBar.vue'
import AppFooter from '@/components/AppFooter.vue'
import { ArrowUp } from '@element-plus/icons-vue'

import { ref } from 'vue'

const showBackTop = ref(true)

</script>

<style scoped>
.scroll-container {
  height: 100vh; /* 减去 header 高度 */
  /* overflow-y: auto; */
}
.backtop-inner {
  width: 60px;
  height: 60px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background-color: rgba(230, 215, 200, 0.6); /* 更淡的奶咖灰 */
  color: #5a4a3b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.backtop-inner:hover {
  background-color: rgba(200, 180, 160, 0.8);
  transform: scale(1.1);
  color: #3e2f24;
}

/* 淡入淡出 + 缩放动画 */
.fade-scale-enter-active,
.fade-scale-leave-active {
  transition: all 0.4s ease;
}
.fade-scale-enter-from,
.fade-scale-leave-to {
  opacity: 0;
  transform: scale(0.8);
}
.fade-scale-enter-to,
.fade-scale-leave-from {
  opacity: 1;
  transform: scale(1);
}


</style>
